home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- // Copyright (C) 1997-2001 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- // ==========================================================================
- // All rights reserved. These coded instructions, statements and computer
- // programs contain unpublished information proprietary to Alias|Wavefront,
- // a division of Silicon Graphics Limited, which is protected by the
- // Canadian and US federal copyright law and may not be disclosed to third
- // parties or copied or duplicated, in whole or in part, without prior
- // written consent of Alias|Wavefront, a division of Silicon Graphics Limited
- // ==========================================================================
- //
- // Creation Date: October 2001
- //
- // Written by: cpam
- //
- // Procedure Name:
- // annotateNode
- //
- // Description:
- // Brings up a prompt dialog to ask the user for an annotation
- // to add to the selected node.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
-
- proc createAnnotation(string $annotation)
- {
- //get the object to annotate
- string $object[] = `ls -sl`;
-
- //make sure it's a valid transform node
- string $checkIfTransform[] = `ls -sl -typ transform $object[0]`;
- if (1 == size($checkIfTransform)) {
-
- // carry on if it is and calculate the offset for the annotation
- // based on the object's bounding box
- float $bbox[] = `xform -q -ws -bb $object[0]`;
- $pos[0] = abs($bbox[3] - $bbox[0]);
- $pos[1] = abs($bbox[4] - $bbox[1]);
- $pos[2] = abs($bbox[5] - $bbox[2]);
-
- // create a locator for easier manipulation
- $locator = `spaceLocator -n "annotationLocator#" `;
- xform -ws -t ($bbox[0]+($pos[0]/2))
- ($bbox[1]+($pos[1]/2))
- ($bbox[2]+($pos[2]/2));
- parent $locator $object[0];
-
- // sort the sides of the bounding box from lowest to highest so
- // that the annotation has a more predictable and consistent offset
- $pos = `sort $pos`;
-
- // add annotation
- select -r $locator;
- $annotationNode = `annotate -tx $annotation
- -p ($bbox[0]+($pos[2]))
- ($bbox[1]+($pos[2]))
- ($bbox[2]+($pos[2]))`;
-
- // get parent transform of annotation
- string $transform[] = `listRelatives -parent $annotationNode`;
-
- // parent annotation to locator
- parent $transform[0] $locator;
- select -r $annotationNode;
- } else {
- error "Invalid object selected; only transform nodes may be annotated.";
- }
- }
-
-
- global proc annotateNode(){
-
- string $result = `promptDialog
- -title "Annotate Node"
- -message "Enter Annotation: "
- -text "Annotation"
- -button "OK"
- -button "Cancel"
- -defaultButton "OK"
- -cancelButton "Cancel"
- -dismissString "Cancel"`;
-
- // If the result was "OK", then proceed
- //
- if ( $result == "OK" ) {
-
- // Get the annotation the user entered
- //
- string $annotation = `promptDialog -q`;
- createAnnotation $annotation;
- }
-
- }
-